#include <16F877A.h>

/*========================================== Controller Configuration Settings========================================*/
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)


/*======================================================main function=================================================*/
void main()
{
   unsigned char g;
   int temp_adc;
   port_b_pullups(true);
   set_tris_b(0xfe);
   setup_port_a(ALL_ANALOG);
   setup_adc(ADC_CLOCK_INTERNAL);
   set_adc_channel(0);
   delay_ms(100);
   
while(1)
{
                  delay_ms(100);
            temp_adc=read_adc();
                  delay_ms(100);
output_b(temp_adc);

	if(temp_adc>215)
           {
		output_D(0xFF);
                  delay_ms(2000);
           }
        else if(temp_adc>150 && temp_adc<215)
           {
		output_D(0x2F);
                  delay_ms(2000);

           }
        else if(temp_adc>105 && temp_adc<150)
           {
		output_D(0xf0);
                  delay_ms(2000);

           }
        else if(temp_adc>50 && temp_adc<105)
           {
		output_D(0xF7);
                  delay_ms(2000);

           }
           else
           {
             	output_D(0xF2);
                  delay_ms(2000);
           }

   }
}


